home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / conv / jpegV5Bbin.lha / doc / cjpeg.man < prev    next >
Encoding:
Text File  |  1995-04-10  |  12.1 KB  |  331 lines

  1.  
  2.  
  3.  
  4. CJPEG(1)                                                 CJPEG(1)
  5.  
  6.  
  7. NAME
  8.        cjpeg - compress an image file to a JPEG file
  9.  
  10. SYNOPSIS
  11.        cjpeg [ options ] [ filename ]
  12.  
  13.  
  14. DESCRIPTION
  15.        cjpeg  compresses  the  named  image file, or the standard
  16.        input if no file is named, and produces a  JPEG/JFIF  file
  17.        on  the  standard  output.   The currently supported input
  18.        file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS
  19.        gray-scale  format), BMP, GIF, Targa, and RLE (Utah Raster
  20.        Toolkit format).   (RLE  is  supported  only  if  the  URT
  21.        library is available.)
  22.  
  23. OPTIONS
  24.        All   switch   names  may  be  abbreviated;  for  example,
  25.        -grayscale may be written  -gray  or  -gr.   Most  of  the
  26.        "basic"  switches  can  be abbreviated to as little as one
  27.        letter.  Upper and lower case are equivalent (thus -GIF is
  28.        the  same  as  -gif).  British spellings are also accepted
  29.        (e.g., -greyscale), though for brevity these are not  men­
  30.        tioned below.
  31.  
  32.        The basic switches are:
  33.  
  34.        -quality N
  35.               Scale  quantization tables to adjust image quality.
  36.               Quality is 0 (worst) to 100 (best); default is  75.
  37.               (See below for more info.)
  38.  
  39.        -grayscale
  40.               Create  monochrome  JPEG file from color input.  Be
  41.               sure  to  use  this  switch  when   compressing   a
  42.               grayscale  GIF  file,  because  cjpeg  isn't bright
  43.               enough to notice  whether  a  GIF  file  uses  only
  44.               shades of gray.  By saying -grayscale, you'll get a
  45.               smaller JPEG file that takes less time to  process.
  46.  
  47.        -optimize
  48.               Perform  optimization  of  entropy encoding parame­
  49.               ters.  Without this,  default  encoding  parameters
  50.               are  used.  -optimize usually makes the JPEG file a
  51.               little smaller, but cjpeg runs somewhat slower  and
  52.               needs much more memory.  Image quality and speed of
  53.               decompression are unaffected by -optimize.
  54.  
  55.        -targa Input file is Targa format.  Targa files that  con­
  56.               tain an "identification" field will not be automat­
  57.               ically recognized by cjpeg; for such files you must
  58.               specify  -targa  to  make  cjpeg treat the input as
  59.               Targa format.  For most Targa files, you won't need
  60.               this switch.
  61.  
  62.  
  63.  
  64.                          12 December 1994                       1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CJPEG(1)                                                 CJPEG(1)
  71.  
  72.  
  73.        The  -quality  switch  lets  you trade off compressed file
  74.        size against  quality  of  the  reconstructed  image:  the
  75.        higher  the quality setting, the larger the JPEG file, and
  76.        the closer the output image will be to the original input.
  77.        Normally  you  want  to  use  the  lowest  quality setting
  78.        (smallest file) that decompresses into something  visually
  79.        indistinguishable  from the original image.  For this pur­
  80.        pose the quality setting should be between 50 and 95;  the
  81.        default of 75 is often about right.  If you see defects at
  82.        -quality 75, then go up 5 or 10 counts at a time until you
  83.        are  happy  with  the  output image.  (The optimal setting
  84.        will vary from one image to another.)
  85.  
  86.        -quality 100 will generate a  quantization  table  of  all
  87.        1's,  eliminating loss in the quantization step (but there
  88.        is still information  loss  in  subsampling,  as  well  as
  89.        roundoff  error).   This setting is mainly of interest for
  90.        experimental purposes.  Quality values above about 95  are
  91.        not  recommended  for normal use; the compressed file size
  92.        goes up dramatically for hardly any gain in  output  image
  93.        quality.
  94.  
  95.        In  the other direction, quality values below 50 will pro­
  96.        duce very small files  of  low  image  quality.   Settings
  97.        around  5 to 10 might be useful in preparing an index of a
  98.        large image library, for example.  Try -quality 2 (or  so)
  99.        for  some  amusing  Cubist effects.  (Note: quality values
  100.        below about 25 generate 2-byte quantization tables,  which
  101.        are considered optional in the JPEG standard.  cjpeg emits
  102.        a warning message when you  give  such  a  quality  value,
  103.        because  some  commercial  JPEG  programs may be unable to
  104.        decode the resulting file.  Use -baseline if you  need  to
  105.        ensure compatibility at low quality values.)
  106.  
  107.        Switches for advanced users:
  108.  
  109.        -dct int
  110.               Use integer DCT method (default).
  111.  
  112.        -dct fast
  113.               Use fast integer DCT (less accurate).
  114.  
  115.        -dct float
  116.               Use floating-point DCT method.  The float method is
  117.               very slightly more accurate than  the  int  method,
  118.               but  is  much  slower  unless your machine has very
  119.               fast  floating-point  hardware.   Also  note   that
  120.               results  of  the  floating-point  method  may  vary
  121.               slightly across machines, while the integer methods
  122.               should  give the same results everywhere.  The fast
  123.               integer method is much less accurate than the other
  124.               two.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                          12 December 1994                       2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CJPEG(1)                                                 CJPEG(1)
  137.  
  138.  
  139.        -restart N
  140.               Emit  a  JPEG  restart  marker every N MCU rows, or
  141.               every N MCU blocks if "B" is attached to  the  num­
  142.               ber.   -restart  0  (the  default) means no restart
  143.               markers.
  144.  
  145.        -smooth N
  146.               Smooth  the  input  image  to  eliminate  dithering
  147.               noise.   N,  ranging  from  1 to 100, indicates the
  148.               strength of smoothing.  0 (the  default)  means  no
  149.               smoothing.
  150.  
  151.        -maxmemory N
  152.               Set limit for amount of memory to use in processing
  153.               large images.  Value is in thousands of  bytes,  or
  154.               millions of bytes if "M" is attached to the number.
  155.               For example, -max 4m  selects  4000000  bytes.   If
  156.               more space is needed, temporary files will be used.
  157.  
  158.        -outfile name
  159.               Send output image to the named file, not  to  stan­
  160.               dard output.
  161.  
  162.        -verbose
  163.               Enable debug printout.  More -v's give more output.
  164.               Also, version information is printed at startup.
  165.  
  166.        -debug Same as -verbose.
  167.  
  168.        The -restart option inserts extra  markers  that  allow  a
  169.        JPEG  decoder to resynchronize after a transmission error.
  170.        Without restart markers, any damage to a  compressed  file
  171.        will usually ruin the image from the point of the error to
  172.        the end of the image; with restart markers, the damage  is
  173.        usually  confined  to  the  portion of the image up to the
  174.        next restart  marker.   Of  course,  the  restart  markers
  175.        occupy  extra  space.   We recommend -restart 1 for images
  176.        that will be transmitted across unreliable  networks  such
  177.        as Usenet.
  178.  
  179.        The  -smooth  option  filters the input to eliminate fine-
  180.        scale noise.  This is often  useful  when  converting  GIF
  181.        files  to  JPEG:  a  moderate smoothing factor of 10 to 50
  182.        gets rid of dithering patterns in the input file,  result­
  183.        ing  in  a  smaller  JPEG file and a better-looking image.
  184.        Too large a smoothing factor will visibly blur the  image,
  185.        however.
  186.  
  187.        Switches for wizards:
  188.  
  189.        -arithmetic
  190.               Use  arithmetic  coding rather than Huffman coding.
  191.               (Not currently supported for legal reasons.)
  192.  
  193.  
  194.  
  195.  
  196.                          12 December 1994                       3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CJPEG(1)                                                 CJPEG(1)
  203.  
  204.  
  205.        -baseline
  206.               Force a baseline JPEG file to be  generated.   This
  207.               clamps  quantization  values  to 8 bits even at low
  208.               quality settings.
  209.  
  210.        -nointerleave
  211.               Generate noninterleaved JPEG  file  (not  yet  sup­
  212.               ported).
  213.  
  214.        -qtables file
  215.               Use  the quantization tables given in the specified
  216.               file.  The file should contain one to  four  tables
  217.               (64  values each) as plain text.  Comments preceded
  218.               by '#' may be included in the file.  The tables are
  219.               implicitly numbered 0,1,etc.  If -quality N is also
  220.               specified,  the  values  in  the  file  are  scaled
  221.               according to cjpeg's quality scaling curve.
  222.  
  223.        -qslots N[,...]
  224.               Select  which  quantization  table  to use for each
  225.               color component.  By default, table 0 is  used  for
  226.               luminance and table 1 for chrominance components.
  227.  
  228.        -sample HxV[,...]
  229.               Set  JPEG  sampling  factors.  If you specify fewer
  230.               H/V pairs than there are components, the  remaining
  231.               components  are  set  to 1x1 sampling.  The default
  232.               setting is equivalent to -sample 2x2.
  233.  
  234.        The "wizard" switches  are  intended  for  experimentation
  235.        with  JPEG.   If  you don't know what you are doing, don't
  236.        use them.  You can easily produce files with  worse  image
  237.        quality and/or poorer compression than you'll get from the
  238.        default settings.  Furthermore, these switches should  not
  239.        be  used  when  making  files  intended  for  general use,
  240.        because not all JPEG implementations will support  unusual
  241.        JPEG parameter settings.
  242.  
  243. EXAMPLES
  244.        This  example compresses the PPM file foo.ppm with a qual­
  245.        ity factor of 60 and saves the output as foo.jpg:
  246.  
  247.               cjpeg -quality 60 foo.ppm > foo.jpg
  248.  
  249. HINTS
  250.        Color GIF files are not the ideal input for JPEG; JPEG  is
  251.        really   intended   for  compressing  full-color  (24-bit)
  252.        images.  In particular, don't  try  to  convert  cartoons,
  253.        line  drawings, and other images that have only a few dis­
  254.        tinct colors.  GIF works great on these,  JPEG  does  not.
  255.        If  you  want to convert a GIF to JPEG, you should experi­
  256.        ment with cjpeg's -quality and -smooth options  to  get  a
  257.        satisfactory  conversion.  -smooth 10 or so is often help­
  258.        ful.
  259.  
  260.  
  261.  
  262.                          12 December 1994                       4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. CJPEG(1)                                                 CJPEG(1)
  269.  
  270.  
  271.        Avoid running an image through a series of  JPEG  compres­
  272.        sion/decompression  cycles.  Image quality loss will accu­
  273.        mulate; after ten or so cycles the image may be noticeably
  274.        worse  than  it  was  after one cycle.  It's best to use a
  275.        lossless format while manipulating an image, then  convert
  276.        to  JPEG format when you are ready to file the image away.
  277.  
  278.        The -optimize option to cjpeg is worth using when you  are
  279.        making  a  "final" version for posting or archiving.  It's
  280.        also a win when you are using low quality settings to make
  281.        very small JPEG files; the percentage improvement is often
  282.        a lot more than it is on larger files.
  283.  
  284. ENVIRONMENT
  285.        JPEGMEM
  286.               If this environment variable is set, its  value  is
  287.               the  default  memory limit.  The value is specified
  288.               as described for the  -maxmemory  switch.   JPEGMEM
  289.               overrides the default value specified when the pro­
  290.               gram was compiled, and itself is overridden  by  an
  291.               explicit -maxmemory.
  292.  
  293. SEE ALSO
  294.        djpeg(1), rdjpgcom(1), wrjpgcom(1)
  295.        ppm(5), pgm(5)
  296.        Wallace,  Gregory  K.  "The JPEG Still Picture Compression
  297.        Standard", Communications of the ACM, April 1991 (vol. 34,
  298.        no. 4), pp. 30-44.
  299.  
  300. AUTHOR
  301.        Independent JPEG Group
  302.  
  303. BUGS
  304.        Arithmetic coding is not supported for legal reasons.
  305.  
  306.        Not  all  variants  of BMP and Targa file formats are sup­
  307.        ported.
  308.  
  309.        The -targa switch is not a bug, it's a feature.  (It would
  310.        be  a bug if the Targa format designers had not been clue­
  311.        less.)
  312.  
  313.        Still not as fast as we'd like.
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                          12 December 1994                       5
  329.  
  330.  
  331.